package com.quectel.taskserver.mock;

import com.quectel.util.spring.SpringUtils;
import org.apache.commons.lang3.StringUtils;

/**
 * 模拟测试
 *
 * @author: caolu
 * @email: louis.cao@quectel.com
 * @date: 2022-07-21 15:07:00
 */
public class MockLimit {


    /**
     * 是否允许mock
     *
     * @return
     */
    public static boolean enableMock() {
        String configValue = SpringUtils.getConfigValue("mock.enable");
        return Boolean.TRUE.toString().equals(configValue);
    }

    /**
     * 需要mock的小区数据
     *
     * @return
     */
    public static String[] mockVillageCodes() {
        if (enableMock()) {
            String configValue = SpringUtils.getConfigValue("mock.village-codes");
            if (StringUtils.isNotBlank(configValue)) {
                return StringUtils.split(configValue, ",");
            }
        }
        return new String[]{};
    }
}
